<?php session_start();?>
<?php include_once 'controller/login.php'; ?>
<?php
include_once'controller/registrasi.php';
include_once'controller/login.php';
include_once 'controller/follow.php';
if(isset ($_POST['submitButton'])) {
// asumsikan semua sudah dicek pakai js
    $lontong = new registrasi();
    $lontong->register($_POST['username'], $_POST['nama'], $_POST['password'], $_POST['tanggalLahir'], $_POST['lokasi'], $_POST['jenisKelamin'], $_POST['email'], $_FILES['fotoProfil'],$_POST['wallprivacy']);
}?>
<?php
include_once 'controller/follow.php';
if (isset($_GET['name_viewed'])!= NULL) {
    $name_viewed = $_GET['name_viewed'];
}
else if (isset($_SESSION['user_name'])!= NULL) {
    $name_viewed = $_SESSION['user_name'];
}
if (isset($_SESSION['user_name'])!= NULL) {
    $name_logon = $_SESSION['user_name'];
    $temp = new login();
    $role = $temp->getRole($name_logon );
}
else $name_logon = NULL;
if (isset($_GET['fol'])!= NULL) {
    $doFoll = new follow();
    if($_GET['fol'] == 'yes') {
        $doFoll->addFollowing($name_logon, $name_viewed);
    }
    else if ($_GET['fol'] == 'no') {
        $doFoll->deleteFollowing($name_logon, $name_viewed);
    }
}

?>

<?php $script = '<script src="http://connect.facebook.net/en_US/all.js"></script>';?>
<?php $judul = 'Log In'; ?>
<?php include_once 'Pecahan/header.php'; ?>

<div id ="content" class="isipage">
    <form action="profil.php" method="post">
        <div class="loginname2">
            <label>User Name </label>
            <input type="text" name="usernameLogin" id="username"/>
        </div>
        <div class="loginpass2">
            <label>Password  </label>
            <input type="password" name="passwordLogin" id="password"/>
        </div>
        <div class="loginbutton2">
            <input type="submit" value="Log In" name="submitButtonLogin" id="submitButtonLogin"/>
        </div>
    </form>
</div>

<?php
$usernameFb = $_POST['username'];
echo'<div id="fb-root"></div>
        <script>
            FB.init({
                appId:"205313469486760", cookie:true,
                status:true, xfbml:true
            });

            FB.ui({ method: "feed",
                message: "'.$usernameFb.' baru saja mendaftar PotoBut, lontong mau juga?"});
        </script>';
?>

<?php include_once 'Chat/chat.php';?>
<?php include_once 'Pecahan/footer.php'; ?>
